<%@page import="java.util.Map"%>
<%@page import="java.util.List"%>
<%@page import= "org.liyufeng.project.pojo.WeixinDepartment"%>;

<%@ page language="java" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>部门添加</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">
<!-- <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> -->
<script src="<%=basePath%>js/bootstrap.min.js"></script>
<script src="<%=basePath%>js/jquery.js"></script>
</head>
 <%List<WeixinDepartment> departmentList = (List<WeixinDepartment>)request.getAttribute("list");  %>
<body>
	<div class="container-fluid">
		<form class="form-search" >
			<div class="row-fluid">
				<div align="left">
					<input type="button" onclick="doAdd()" value="添加" />
					<input type="button" onclick="del()" value="删除" />
					<input type="button" onclick="update()" value="修改" />
					<input type="button" onclick="button()" value=">提交PIMS" />
					<br/>
					部门ID：<input class="input-medium search-query" type="text" id="companyID">
					
					<input type="button" onclick="doQuery()" value="查找" />
					<table>
					<tr>
							<td><input type="checkbox" id="chekboxIds" value="" onclick="check()"/></td>
							<td>ID</td>
							<td>部门名称</td>
							<td>部门上级部门ID</td>
					</tr>
				
					<%		 for(WeixinDepartment department:departmentList){  
				  %>		
				  		<tr>
				  			<td><input type="checkbox"  name="chekboxId"  value="<%=department.getId() %>" /></td>
				  			<td><%=department.getId() %></td>
							<td><%=department.getName() %></td>
							<td><%=department.getParentid() %></td>
						</tr>
				 <%} %>
					</table>
		</form>
	</div>

</body>
<script type="text/javascript">
//添加事件
	function doAdd() {
		window.location.href = '<%=basePath%>/add';
				
			}
	//全选事件
	function check(){
		
	}
	//查询事件
	function doQuery(){
		var id=document.getElementById("companyID").value;
		window.location.href='<%=basePath%>/queryByid?id='+id;
	}
	//修改事件
	function update(){
		var str=document.getElementsByName("chekboxId");
		var objarray=str.length;
		var id="";
		for (i=0;i<objarray;i++){
			if(str[i].checked == true){
				id=str[i].value;
				window.location.href='<%=basePath%>/add?id='+id;
			}
			
		}
	}
	//删除事件
	function del(){
		var str=document.getElementsByName("chekboxId");
		var objarray=str.length;
		var id="";
		for (i=0;i<objarray;i++){
			if(str[i].checked == true){
				id=str[i].value;
				window.location.href='<%=basePath%>/del?id='+id;
			}
			
		}
	}
</script>
</html>